<?php
header('content-type:text/html;charset=utf-8');
require './public_function.php';
$link=dbInit();
if(!empty($_POST)){
    $fields=array('administrator_account','administrator_password');
    $values=array();
    foreach($fields as $k => $v){
        $data=isset($_POST[$v]) ? $_POST[$v] : '';
        if($data=='') die($v.'字段不能为空');
//        $data=safeHandle($data);
        $fields[$k]="`$v`";
        $values[]=$data;

    }
    $fields=implode(',',$fields);
    $values=implode(',',$values);
    $sql="insert into `administrator` ($fields) values ($values)";
    if($res=mysqli_query($link,$sql)){
        header('Location:./admin.php');
        die;
    }else{
        die('员工添加失败!'.mysqli_error($link));
    }
}
define('APP','jfgl');
require './admin_ADD.php';
?>